<template>
  <div>
    <!-- 面包屑导航区 -->
      <el-breadcrumb separator-class="el-icon-arrow-right">
          <el-breadcrumb-item>预定进程/历史</el-breadcrumb-item>
          <el-breadcrumb-item>查看当前预定</el-breadcrumb-item>
      </el-breadcrumb>

      <!-- 当前预定 -->
      <el-card>
        <el-table :data="tableData">
          <el-table-column label="会议室" prop="cid"></el-table-column>
          <el-table-column label="会议人数" prop="peopleCount"></el-table-column>
          <el-table-column label="开始时间" prop="startTime"></el-table-column>
          <el-table-column label="结束时间" prop="endTime"></el-table-column>
          <el-table-column label="创建时间" prop="createTime"></el-table-column>
          <el-table-column label="签到状态" prop="status"></el-table-column>
        </el-table>

        <el-pagination
                background
                layout="prev, pager, next"
                :page-size="pageSize"
                :total="totalNumber"
                @current-change="page">
        </el-pagination>
      </el-card>
  </div>
</template>

<script>
export default {
  data() {
      return {
        pageSize: 12,
        totalNumber: null,
        tableData: null
      }
  },

  methods: {
      getList(){
          this.$axios({
              method:"post",
              url:"http://localhost:80/orderrecord/getRecordsPage",
              params:{
                  uid:window.sessionStorage.getItem("id"),
                  current:0,
                  size:3
              }
          }).then(res=>{
              console.log(res)
              this.tableData = res.data.data.records
              console.log(this.tableData)
              this.pageSize = res.data.data.size
              console.log(this.pageSize)
              let total = res.data.data.total
              // console.log(res.data.data.total)
              this.totalNumber = total
              // console.log(this.totalNumber)
          })

      },
    async page(currentPage){
          console.log(currentPage)
      this.$axios({
          method:"post",
          url:"http://localhost:80/orderrecord/getRecordsPage",
          params:{
              uid:window.sessionStorage.getItem("id"),
              current:currentPage,
              size:3
          }
      }).then(res=>{
          // console.log(res)
          this.tableData = res.data.data.records
          // console.log(this.tableData)
          this.pageSize = res.data.data.size
          console.log(res.data.data)
          let total = res.data.data.total
           this.totalNumber = total
      })
      // console.log(res)
    }
  },

  async created() {

    // this.tableData = res.content
    // this.pageSize = res.size
    // this.total = res.totalElements
        this.getList()
  }
};
</script>

<style lang="less" scoped>
</style>
